<template>
  <div class="header">
      <div v-if="leftArrow" class="header-left" @click="fnOpenpage()">
          <i class="iconfont icon-mjiantou-copy"></i>
      </div>
      <div v-else class="header-left"></div>
      <div class="header-in">{{title}}</div>
      <div class="header-rigth"></div>
  </div>
</template>

<script>
export default {
  name:"header",
  props:[
      "title",
      "leftArrow"
  ],
  created() {
    document.title = this.title
  },
  methods: {
    fnOpenpage() {
      // 如果是分享进来的就直接返回首页
      if(this.$route.query.productDetail){
        this.$router.replace({
          name: 'Home'
        })
      }else {
        this.$router.go(-1)
      }      
    }
  }
}
</script>

<style lang="stylus" scoped>
.header
    width 100%
    height 1.45rem
    background white
    position fixed
    top: 0
    z-index 1
    .header-left
        width 10%
        height 100%
        float left
        i
            font-size: 0.6rem;
            line-height: 1.45rem;
            text-align: center;
            display: block;
    .header-in
        width: 80%;
        float: left;
        text-align: center;
        font-size: 0.45rem;
        line-height: 1.45rem;
    .header-rigth
        width 10%
        height 100%
        float left

</style>
